﻿<?xml version="1.0" encoding="utf-8" ?>
<dbTest>
  <scripts>
    <script name="delete-all-patients">
      DELETE [dbo].[Patient];
    </script>

    <script name="AddPatient_GivenANewPatient_RecordMustBeInserted">
      SELECT FirstName, LastName, Address1, Address2, City, State, Zip, DOB, SSN
      FROM [dbo].[Patient]
      WHERE SSN = '123456789';
    </script>

    <script name="UpdatePatient_GivenAnExistentPatient_RecordMustBeUpdated">
      SELECT PatientId, FirstName, LastName, Address1, Address2, City, State, Zip, DOB, SSN
      FROM [dbo].[Patient]
      WHERE PatientId = 1;
    </script>

    <script name="DeletePatient_GivenAPatientId_RecordMustBeSetAsDeleted">
      SELECT PatientId, Deleted
      FROM [dbo].[Patient]
      WHERE PatientId = 11;
    </script>

  </scripts>

  <datasets>
    <dataset name="AddPatient_GivenANewPatient_RecordMustBeInserted" setIdentityInsert="false">
      <data>
        <row FirstName="test-first-name" LastName="test-last-name" Address1="test-address1" Address2="test-address2" City="test-city" State="WI" Zip="12345" DOB="2000-01-02T00:00:00" SSN="123456789" />
      </data>
    </dataset>

    <dataset name="new-patient" setIdentityInsert="true" table="Patient">
      <data>
        <row PatientId="1" FirstName="test-first-name" LastName="test-last-name" Address1="test-address1" Address2="test-address2" City="test-city" State="WI" Zip="12345" DOB="2000-01-02T00:00:00" SSN="123456789" />
      </data>
    </dataset>

    <dataset name="UpdatePatient_GivenAnExistentPatient_RecordMustBeUpdated" table="Patient">
      <data>
        <row PatientId="1" FirstName="test-first-name-u" LastName="test-last-name-u" Address1="test-address1-u" Address2="test-address2-u" City="test-city-u" State="IL" Zip="12346" DOB="2000-01-03T00:00:00" SSN="123456780" />
      </data>
    </dataset>

    <dataset name="several-patients" setIdentityInsert="true" table="Patient">
      <data>
        <row PatientId="1" FirstName="test-first-name1" LastName="test-last-name1" Address1="test-address1-1" Address2="test-address2-1" City="test-city1" State="01" Zip="12345-1" DOB="2000-01-01T00:00:00" SSN="100000000" />
        <row PatientId="11" FirstName="test-first-name11" LastName="test-last-name11" Address1="test-address1-11" Address2="test-address2-11" City="test-city1" State="11" Zip="12345-11" DOB="2000-01-11T00:00:00" SSN="110000000" />
        <row PatientId="2" FirstName="test-first-name2" LastName="test-last-name2" Address1="test-address1-2" Address2="test-address2-2" City="test-city2" State="02" Zip="12345-2" DOB="2000-01-02T00:00:00" SSN="200000000" />
        <row PatientId="22" FirstName="test-first-name22" LastName="test-last-name22" Address1="test-address1-22" Address2="test-address2-22" City="test-city22" State="22" Zip="12345-22" DOB="2000-01-22T00:00:00" SSN="220000000" />
      </data>
    </dataset>

    <dataset name="DeletePatient_GivenAPatientId_RecordMustBeSetAsDeleted" table="Patient">
      <data>
        <row PatientId="11" Deleted="true" />
      </data>
    </dataset>

  </datasets>
</dbTest>
